#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["BCCServer.Web/BCCServer.Web.csproj", "BCCServer.Web/"]
COPY ["BCC.Service/BCCServer.Service.csproj", "BCC.Service/"]
COPY ["BCCServer.Common/BCCServer.Common.csproj", "BCCServer.Common/"]
COPY ["BCCServer.DAO/BCCServer.DAO.csproj", "BCCServer.DAO/"]
COPY ["BCCServer.Model/BCCServer.Model.csproj", "BCCServer.Model/"]
COPY ["BCCServer.IService/BCCServer.IService.csproj", "BCCServer.IService/"]
RUN dotnet restore "BCCServer.Web/BCCServer.Web.csproj"
COPY . .
WORKDIR "/src/BCCServer.Web"
RUN dotnet build "BCCServer.Web.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "BCCServer.Web.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "BCCServer.Web.dll"]